package test;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class ArnoIntegrate {
	public static void main(String[] args) throws SQLException {
		Connection con=DAO.DbcpConnection.getConnection();
		String sql="select * from tmparno";
		Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
		ResultSet rs=st.executeQuery(sql);
		String sqlUpdate="update tmpshoes set remove=1,uukey2=? where arnofromarno=? and uukey<>?";
		PreparedStatement pst=con.prepareStatement(sqlUpdate);
		int i=0;
		while (rs.next()) {
			System.out.println(i++);
			String arno=rs.getString("arnofromarno");
			long uukey=rs.getLong("uukey");
			pst.setLong(1, uukey);
			pst.setString(2, arno);
			pst.setLong(3, uukey);
			pst.execute();
		}
	}
}
